<%@ page language="java" import="java.io.*,java.util.*"
contentType="text/html; charset=UTF-8"
 session="true" 
    pageEncoding="UTF-8"%>
<%
// Get session creation time.
Date createTime = new Date(session.getCreationTime());
// Get last access time of this web page.
Date lastAccessTime = new Date(session.getLastAccessedTime());
String sessionId=session.getId();
String message="Here is your session info.";
Integer actionCount=0;
if (session.isNew()){
    message = "Welcome to my website";    
    session.setAttribute("actionCount",  actionCount);    
 } 
actionCount = (Integer)session.getAttribute("actionCount");
actionCount++;
session.setAttribute("actionCount",  actionCount);
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Session User Info</title>
</head>
<body>
<h2>Session Information page A</h2>
<ul>
<li><b>Message:</b>
   <%= message %>
</li>
<li><b>Session ID:</b>
   <%= sessionId %>
</li>
<li><b>Session Create Time:</b>
   <%= createTime.toString() %>
</li>
<li><b>Session Last Use Time:</b>
   <%= lastAccessTime.toString() %>
</li>
<li><b>Activity Count:</b>
   <%= actionCount %>
</li>
</ul>
</body>
</html>